{% extends "base.html" %}
{% block title %}Post Creation{% endblock %}
{% block body %}
<div class="p-4 shadow-sm">
    <div class="row">
        <div class="col">
            <h1>Edit Post</h1>
        </div>
    </div>

<div class="row">
    <form method="POST" action="{{ url_for('.edit_post', id=post.id) }}">
        {{ form.hidden_tag() }}
        <div class="form-group">
            {{ form.title.label }}
            {% if form.title.errors %}
            {% for e in form.title.errors %}
            <p class="help-block">{{ e }}</p>
            {% endfor %}
            {% endif %}
            {{ form.title(class_='form-control') }}
        </div>
        <div class="form-group">
            {{ form.youtube_id.label }}
            {% if form.youtube_id.errors %}
            {% for e in form.youtube_id.errors %}
            <p class="help-block">{{ e }}</p>
            {% endfor %}
            {% endif %}
            {{ form.youtube_id(class_='form-control') }}
        </div>
        <div class="form-group">
            {{ form.text.label }}
            {% if form.text.errors %}
            {% for e in form.text.errors %}
            <p class="help-block">{{ e }}</p>
            {% endfor %}
            {% endif %}
            {{ form.text(id="editor", class_='form-control') }}
        </div>
        <input class="btn btn-primary" type="submit" value="Submit">
    </form>
</div>
</div>
    {% endblock %}

{% block js %}
<script src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js">
</script>
<script>
    CKEDITOR.replace('editor');
</script>
{% endblock %}
